
#include <Archaism/Random.h>
#include <ctime>
#include <cstdlib>

_BeginNamespace(Radix)

Random::Random()
	:mSeed(0)
{
	mSeed = static_cast<uint>(std::time(nullptr)%1024);
	std::srand(mSeed);
}

Random::~Random()
{}

int Random::next()
{
	return std::rand();
}

int Random::next(int minValue, int maxValue)
{
	return minValue + (static_cast<int>((maxValue-minValue)*(std::rand()*1.0f/RAND_MAX)));
}

float Random::next(float minValue, float maxValue)
{
	return minValue+((maxValue-minValue)*(std::rand()*1.0f/RAND_MAX));
}

double Random::next(double minValue, double maxValue)
{
	return minValue+((maxValue-minValue)*(std::rand()*1.0/RAND_MAX));
}

_EndNamespace(Radix)
